home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / quasrsql.zip / SQL.DOC < prev    next >
Text File  |  1992-01-16  |  125KB  |  3,225 lines

  1.  
  2.           Quasar SQL API                                       Page 1 of 52
  3.  
  4.  
  5.                               Quasar SQL For Windows
  6.  
  7.                            Release 2.0 - November 1991
  8.  
  9.  
  10.                QUASAR SQL APPLICATIONS PROGRAMMING INTERFACE (API)
  11.  
  12.  
  13.                    Copyright (c) 1991-92 by Stellar Industries
  14.                                All Rights Reserved
  15.  
  16.  
  17.                                      Summary
  18.  
  19.  
  20.           This manual is divided into six sections:
  21.  
  22.           Overview       This section describes, in general terms, what
  23.                          the Quasar SQL API is and how you might use it
  24.                          to execute SQL statements within your program.
  25.                          Examples are available both in 'C' (EXAMPLEC.*)
  26.                          and 'Visual Basic' (EXAMPLEB.*).
  27.  
  28.           Functions      This section includes a formal description of
  29.                          all functions which your program can import
  30.                          from the Quasar SQL API dynamic link library
  31.                          (SQL.LIB, SQL.DLL).  Prototypes for all
  32.                          functions can be found in the Quasar SQL API
  33.                          include file for 'C' (SQL.H) and the global
  34.                          file for 'Visual Basic' (SQL.GBL).
  35.  
  36.           Constants      This section includes a formal description of
  37.                          all constants defined in the Quasar SQL API
  38.                          include file for 'C' and the global file for
  39.                          'Visual Basic'.
  40.  
  41.           Data Structures This section includes a formal description of
  42.                          all data structures which your program will use
  43.                          when it communicates with the Quasar SQL API.
  44.                          Typedefs for all these structures can be found
  45.                          in the Quasar SQL API include file for 'C'.
  46.                          Declarations can be found in the global file
  47.                          for 'Visual Basic'.
  48.  
  49.           Result Codes   This section gives an explanation of all result
  50.                          codes returned by the Quasar SQL API.  Macro
  51.                          definitions for all result codes can be found
  52.                          in the Quasar SQL API include file for 'C'.
  53.                          Global Const definitions can be found in the
  54.                          global file for 'Visual Basic'.
  55.  
  56.           Glossary       This section defines specialized terms used in
  57.                          this document.
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                     Summary
  64.           Quasar SQL API                                       Page 2 of 52
  65.  
  66.  
  67.                                      Overview
  68.  
  69.  
  70.           What is the Quasar SQL API?
  71.  
  72.                     The Quasar SQL API is a powerful tool that enables
  73.                     you, the software developer, to have full access to
  74.                     a modern, highly optimized ANSI standard SQL
  75.                     database manager: the Quasar Database Administrator.
  76.                     Your programs written in any language which can
  77.                     access dynamic link libraries can also access the
  78.                     Quasar SQL API.  These languages include 'C', 'C++',
  79.                     'Visual Basic', 'Pascal' and most assemblers.  In
  80.                     fact, any program which can access the Microsoft
  81.                     Windows environment can access the Quasar SQL API.
  82.                     Microsoft Windows itself is a dynamic link library.
  83.  
  84.                     The Quasar SQL API is your gateway to modern
  85.                     database technology.  With a little more than a
  86.                     dozen functions and only 4 data structures you can
  87.                     perform almost any database task.
  88.  
  89.           How does the Quasar SQL API work?
  90.  
  91.                     "How is this done?" you might ask.  Well, while the
  92.                     Quasar Database Administrator is sophisticated,
  93.                     complex and fully optimized for maximum performance:
  94.                     the Quasar SQL API is simple and straight forward.
  95.                     The Quasar SQL API effectively buffers you from all
  96.                     the complex tasks of parsing, query analysis, query
  97.                     optimization, query tree construction, etc.
  98.  
  99.           How do I link to the Quasar SQL API?
  100.  
  101.                     When programming in 'C', you need to do only three
  102.                     things to include all the power of SQL in your
  103.                     application:
  104.  
  105.                     1)   When you link your object modules, include the
  106.                          SQL.LIB import library along with LIBW.LIB.
  107.  
  108.                     2)   Include the SQL.H file (e.g.  "#include
  109.                          <SQL.H>") in your source code.
  110.  
  111.                     3)   Put the Quasar Database Administrator (DBA.EXE)
  112.                          and Quasar SQL API (SQL.DLL) someplace where
  113.                          windows can find them (usually in your windows
  114.                          directory).
  115.  
  116.                     When programming in 'Visual Basic', you need to do
  117.                     only two things to include all the power of SQL in
  118.                     your application:
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.                                                                    Overview
  126.           Quasar SQL API                                       Page 3 of 52
  127.  
  128.  
  129.                     1)   Be sure to use the SQL.GBL file included with
  130.                          the Quasar SQL API.  Note that the 'C' style
  131.                          prefixes used with variable names (i.e.  the
  132.                          'n' in nResultCode, and the 'sz' in
  133.                          szErrorMessage) are not used with 'Visual
  134.                          Basic'.
  135.  
  136.                     2)   Put the Quasar Database Administrator (DBA.EXE)
  137.                          and Quasar SQL API (SQL.DLL) someplace where
  138.                          windows can find them (usually in your windows
  139.                          directory).
  140.  
  141.           How do I use the Quasar SQL API?
  142.  
  143.                     Your program can login to the Quasar Database
  144.                     Administrator (SqlLogin), open a cursor
  145.                     (SqlCursorOpen) and execute a query (SqlExecute).
  146.                     The query itself is passed to the Quasar SQL API as
  147.                     a simple text string.  The Quasar SQL API does all
  148.                     the work for you.  To get your answers back (from a
  149.                     SELECT statement, for example) you simply fetch them
  150.                     one at a time from the Quasar SQL API.  You can
  151.                     fetch the first record (SqlFetchFirst), last record
  152.                     (SqlFetchLast), next record (SqlFetchNext), previous
  153.                     record (SqlFetchPrevious) or even a record at a
  154.                     position you specify (SqlFetchPositioned).
  155.  
  156.                     You can have several cursors open at a time so that
  157.                     you can access your data the way you want.
  158.  
  159.                     When you're all done, close your cursors
  160.                     (SqlCursorClose) and log out (SqlLogout).
  161.  
  162.           How can I check out my SQL statements?
  163.  
  164.                     You can check out your SQL statements using the
  165.                     Quasar Query Editor (QE.EXE) included with the
  166.                     Quasar SQL API.  The Quasar Query Editor allows you
  167.                     to type in the query your program is going to send
  168.                     to the Quasar SQL API and have it execute right
  169.                     there in front of you.  You'll get all the results
  170.                     back on the screen where you can verify it's what
  171.                     you expected.  In fact, the Quasar Query Editor uses
  172.                     the Quasar SQL API the same way your program does.
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.                                                                    Overview
  188.           Quasar SQL API                                       Page 4 of 52
  189.  
  190.  
  191.                                     Functions
  192.  
  193.  
  194.           All Quasar SQL API functions utilize a common structure to
  195.           maintain generic information : SQLCONTROL.  All functions load
  196.           descriptive error information into this structure should an
  197.           error condition arise.  The basic status condition is the
  198.           nResultCode field of this data structure.  All Quasar SQL API
  199.           functions set this field to the appropriate result code in the
  200.           event of an error.  Note: All Quasar SQL API functions clear
  201.           this field to 0 at entry.
  202.  
  203.           SqlCursorClose      Closes a cursor when it is no longer
  204.                               needed
  205.  
  206.           SqlCursorOpen       Opens a cursor in preparation for
  207.                               executing a query
  208.  
  209.           SqlDescribeColumn   Describes an individual column in the
  210.                               result table
  211.  
  212.           SqlDescribeTable    Describes the overall characteristics of
  213.                               the result table
  214.  
  215.           SqlExecute          Causes the database administrator to
  216.                               execute a query and potentially create a
  217.                               result table
  218.  
  219.           SqlFetchFirst       Retrieves the first record from the result
  220.                               table
  221.  
  222.           SqlFetchLast        Retrieves the last record from the result
  223.                               table
  224.  
  225.           SqlFetchNext        Retrieves the next record from the table
  226.  
  227.           SqlFetchPrevious    Retrieves the previous record from the
  228.                               result table
  229.  
  230.           SqlFetchPositioned  Retrieves a particular record from the
  231.                               result table.  The record is identified by
  232.                               its absolute physical position in the
  233.                               table
  234.  
  235.           SqlGetStatus        Gets status information concerning the
  236.                               last query executed
  237.  
  238.           SqlLogin            Logs an user onto the database
  239.                               administrator
  240.  
  241.           SqlLogout           Logs an user off the database
  242.                               administrator
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.                                                                   Functions
  250.           Quasar SQL API                                       Page 5 of 52
  251.  
  252.  
  253.                             Functions: SqlCursorClose
  254.  
  255.  
  256.           Syntax         BOOL FAR PASCAL SqlCursorClose(hUser, hCursor,
  257.                               lpSqlControl)
  258.  
  259.                          This function closes the cursor specified by
  260.                          the hCursor parameter and drops any result
  261.                          table associated with it.
  262.  
  263.                          Parameter      Type/Description
  264.  
  265.                          hUser          HANDLE Identifies the user who
  266.                                         owns the cursor.  The hUser
  267.                                         parameter must have been created
  268.                                         with the SqlLogin function.
  269.  
  270.                          hCursor        HANDLE Identifies the cursor to
  271.                                         be closed.  The hCursor
  272.                                         parameter must have been created
  273.                                         with the SqlCursorOpen function.
  274.  
  275.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  276.                                         control structure.  Any errors
  277.                                         that may occur cause the
  278.                                         szErrorDetail, szErrorMessage
  279.                                         and nResultCode fields of this
  280.                                         structure to be loaded with
  281.                                         descriptive information.
  282.  
  283.           Return Value   The return value is 1 if no errors occurred
  284.                          while closing the cursor, otherwise it is 0.
  285.  
  286.           Comments       Cursors should be closed before logging off
  287.                          with SqlLogout.
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.                                                   Functions: SqlCursorClose
  312.           Quasar SQL API                                       Page 6 of 52
  313.  
  314.  
  315.                              Functions: SqlCursorOpen
  316.  
  317.  
  318.           Syntax         HANDLE FAR PASCAL SqlCursorOpen(hUser,
  319.                               lpSqlControl)
  320.  
  321.                          This function creates a cursor.  You must
  322.                          create a cursor after you have logged in
  323.                          (SqlLogin) and before you execute a query
  324.                          (SqlExecute).  You can create as many cursors
  325.                          as you need for your application.
  326.  
  327.                          Parameter      Type/Description
  328.  
  329.                          hUser          HANDLE Identifies the user who
  330.                                         will own the cursor.  The hUser
  331.                                         parameter must have been created
  332.                                         with the SqlLogin function.
  333.  
  334.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  335.                                         Control Structure.  Any errors
  336.                                         that may occur cause the
  337.                                         szErrorDetail, szErrorMessage
  338.                                         and nResultCode fields of this
  339.                                         structure to be loaded with
  340.                                         descriptive information.
  341.  
  342.           Return Value   The return value is a cursor handle if no
  343.                          errors occurred while opening the cursor,
  344.                          otherwise it is 0.
  345.  
  346.           Comments       The cursors created by one user are not
  347.                          available to another.  Once a cursor has been
  348.                          created and used in an SqlExecute, it may be
  349.                          reused in another SqlExecute by the same user.
  350.                          When a cursor is reused in this manner, the
  351.                          Quasar SQL API effectively closes the cursor
  352.                          and re-opens it with the same handle prior to
  353.                          executing the next query.  Note that when a
  354.                          cursor is reused, any old result table
  355.                          associated with it is dropped.  Cursors are
  356.                          closed with SqlCursorClose.  Cursors should be
  357.                          closed before logging off with SqlLogout.
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.                                                    Functions: SqlCursorOpen
  374.           Quasar SQL API                                       Page 7 of 52
  375.  
  376.  
  377.                            Functions: SqlDescribeColumn
  378.  
  379.  
  380.           Syntax         BOOL FAR PASCAL SqlDescribeColumn(hUser,
  381.                               hCursor, lpSqlControl,
  382.                               nColumnSequenceNumber, lpSqlColumn)
  383.  
  384.                          This function describes the characteristics of
  385.                          the specified column (nColumnSequenceNumber) in
  386.                          the result table associated with the hCursor
  387.                          parameter.  The description is loaded into the
  388.                          SQLCOLUMN structure pointed to by the
  389.                          lpSqlColumn parameter.  To describe a column
  390.                          you must have already logged in (SqlLogin),
  391.                          created a cursor (SqlCursorOpen) and executed a
  392.                          query (SqlExecute) which contained an SQL
  393.                          SELECT statement.
  394.  
  395.                          Parameter      Type/Description
  396.  
  397.                          hUser          HANDLE Identifies the user who
  398.                                         owns the cursor.  The hUser
  399.                                         parameter must have been created
  400.                                         with the SqlLogin function.
  401.  
  402.                          hCursor        HANDLE Identifies the cursor
  403.                                         which owns the result table in
  404.                                         which the column exists.  The
  405.                                         hCursor parameter must have been
  406.                                         created with the SqlCursorOpen
  407.                                         function.  A result table must
  408.                                         be associated with the cursor.
  409.                                         A result table is created when a
  410.                                         query containing an SQL SELECT
  411.                                         statement is passed to
  412.                                         SqlExecute.
  413.  
  414.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  415.                                         Control Structure.  Any errors
  416.                                         that may occur cause the
  417.                                         szErrorDetail, szErrorMessage
  418.                                         and nResultCode fields of this
  419.                                         structure to be loaded with
  420.                                         descriptive information.
  421.  
  422.                          nColumnSequenceNumber    unsigned Identifies
  423.                                         the column to be described.
  424.                                         Column numbers range from 1 to
  425.                                         the number of columns in the
  426.                                         result table.
  427.  
  428.                          lpSqlColumn    LPSQLCOLUMN Points to the target
  429.                                         SQL Column Description
  430.                                         Structure.
  431.  
  432.  
  433.  
  434.  
  435.                                                Functions: SqlDescribeColumn
  436.           Quasar SQL API                                       Page 8 of 52
  437.  
  438.  
  439.           Return Value   The return value is 1 if no errors occurred,
  440.                          otherwise it is 0.
  441.  
  442.           Comments       If a result table is not associated with the
  443.                          cursor an error will be generated.
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.                                                Functions: SqlDescribeColumn
  498.           Quasar SQL API                                       Page 9 of 52
  499.  
  500.  
  501.                            Functions: SqlDescribeTable
  502.  
  503.  
  504.           Syntax         BOOL FAR PASCAL SqlDescribeTable(hUser,
  505.                               hCursor, lpSqlControl, lpSqlTable)
  506.  
  507.                          This function describes the characteristics of
  508.                          the result table associated with the hCursor
  509.                          parameter.  The description is loaded into the
  510.                          SQLTABLE structure pointed to by the lpSqlTable
  511.                          parameter.  To describe a table you must have
  512.                          already logged in (SqlLogin), created a cursor
  513.                          (SqlCursorOpen) and executed a query
  514.                          (SqlExecute) which contained an SQL SELECT
  515.                          statement.
  516.  
  517.                          Parameter      Type/Description
  518.  
  519.                          hUser          HANDLE Identifies the user who
  520.                                         owns the cursor.  The hUser
  521.                                         parameter must have been created
  522.                                         with the SqlLogin function.
  523.  
  524.                          hCursor        HANDLE Identifies the cursor
  525.                                         which owns the result table.
  526.                                         The hCursor parameter must have
  527.                                         been created with the
  528.                                         SqlCursorOpen function.  A
  529.                                         result table must be associated
  530.                                         with the cursor.  A result table
  531.                                         is created when a query
  532.                                         containing an SQL SELECT
  533.                                         statement is passed to
  534.                                         SqlExecute.
  535.  
  536.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  537.                                         Control Structure.  Any errors
  538.                                         that may occur cause the
  539.                                         szErrorDetail, szErrorMessage
  540.                                         and nResultCode fields of this
  541.                                         structure to be loaded with
  542.                                         descriptive information.
  543.  
  544.                          lpSqlTable     LPSQLTABLE Points to the target
  545.                                         SQL Table Description Structure.
  546.  
  547.           Return Value   The return value is 1 if no errors occurred,
  548.                          otherwise it is 0.
  549.  
  550.           Comments       If a result table is not associated with the
  551.                          cursor an error will be generated.
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.                                                 Functions: SqlDescribeTable
  560.           Quasar SQL API                                      Page 10 of 52
  561.  
  562.  
  563.                               Functions: SqlExecute
  564.  
  565.  
  566.           Syntax         BOOL FAR PASCAL SqlExecute(hUser, hCursor,
  567.                               lpSqlControl, lpstrQueryText)
  568.  
  569.                          This function executes the query text pointed
  570.                          to by the lpstrQueryText parameter as a set of
  571.                          one or more SQL statements.  If an SQL SELECT
  572.                          statement is included in the query text, a
  573.                          result table is created and associated with the
  574.                          hCursor parameter.  To execute a query you must
  575.                          have already logged in (SqlLogin) and created a
  576.                          cursor (SqlCursorOpen).
  577.  
  578.                          Parameter      Type/Description
  579.  
  580.                          hUser          HANDLE Identifies the user who
  581.                                         owns the cursor.  The hUser
  582.                                         parameter must have been created
  583.                                         with the SqlLogin function.
  584.  
  585.                          hCursor        HANDLE Identifies the cursor
  586.                                         which will own the result table
  587.                                         if one is created by the query.
  588.                                         The hCursor parameter must have
  589.                                         been created with the
  590.                                         SqlCursorOpen function.
  591.  
  592.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  593.                                         Control Structure.  Any errors
  594.                                         that may occur cause the
  595.                                         szErrorDetail, szErrorMessage
  596.                                         and nResultCode fields of this
  597.                                         structure to be loaded with
  598.                                         descriptive information.
  599.                                         Additionally, syntax errors
  600.                                         detected by the query manager
  601.                                         cause the nHiLiteOffset field to
  602.                                         be loaded with the character
  603.                                         position of the offending phrase
  604.                                         within the query text.  In this
  605.                                         case, the nHiLiteLength field is
  606.                                         loaded with the number of
  607.                                         characters in the offending
  608.                                         phrase.
  609.  
  610.                          lpstrQueryText LPSTR Points to a null
  611.                                         terminated string containing the
  612.                                         SQL query.  The SQL query may
  613.                                         contain one or more SQL
  614.                                         statements.  Among the SQL
  615.                                         statements there can be only 0
  616.                                         or 1 SQL SELECT statement.
  617.  
  618.  
  619.  
  620.  
  621.                                                       Functions: SqlExecute
  622.           Quasar SQL API                                      Page 11 of 52
  623.  
  624.  
  625.           Return Value   The return value is 1 if no errors occurred,
  626.                          otherwise it is 0.
  627.  
  628.           Comments       Simply calling SqlExecute does not commit your
  629.                          query.  Queries are committed when you execute
  630.                          an SQL COMMIT WORK statement.  Be sure to
  631.                          execute this vital statement whenever you want
  632.                          your program to permanently modify the
  633.                          database.
  634.  
  635.                          Each user must close all cursors which have an
  636.                          associated result table before executing an SQL
  637.                          COMMIT WORK statement.  This is to insure that
  638.                          your application has completed its access to
  639.                          the result table before permanently committing
  640.                          the transaction.  A convenient way to do this
  641.                          is to use the same cursor for the COMMIT WORK
  642.                          as you did for the SELECT: the Quasar SQL API
  643.                          automatically drops any result table that may
  644.                          be associated with a cursor when the cursor is
  645.                          reused.
  646.  
  647.                          Without the SQL COMMIT WORK statement, all your
  648.                          transactions will be rolled back when either an
  649.                          error occurs or when you log off (SqlLogout).
  650.                          The only exception to this is if you have the
  651.                          mSqlFlagAutoCommitOnLogout option flag set in
  652.                          the wFlags field of the lpSqlControl parameter
  653.                          when you log off.  Only in this case are all
  654.                          your transactions automatically committed at
  655.                          logout, and then only if no errors have
  656.                          occurred.
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.                                                       Functions: SqlExecute
  684.           Quasar SQL API                                      Page 12 of 52
  685.  
  686.  
  687.                              Functions: SqlFetchFirst
  688.  
  689.  
  690.           Syntax         BOOL FAR PASCAL SqlFetchFirst(hUser, hCursor,
  691.                               lpSqlControl, lpRecordBuffer)
  692.  
  693.                          This function reads the first record in the
  694.                          result table associated with the hCursor
  695.                          parameter.  The data in this record is
  696.                          formatted and loaded into the buffer pointed to
  697.                          by the lpRecordBuffer parameter.  To fetch this
  698.                          record you must have already logged in
  699.                          (SqlLogin), created a cursor (SqlCursorOpen)
  700.                          and executed a query (SqlExecute) which
  701.                          contained an SQL SELECT statement.
  702.  
  703.                          Parameter      Type/Description
  704.  
  705.                          hUser          HANDLE Identifies the user who
  706.                                         owns the cursor.  The hUser
  707.                                         parameter must have been created
  708.                                         with the SqlLogin function.
  709.  
  710.                          hCursor        HANDLE Identifies the cursor
  711.                                         which owns the result table in
  712.                                         which the record exists.  The
  713.                                         hCursor parameter must have been
  714.                                         created with the SqlCursorOpen
  715.                                         function.  A result table must
  716.                                         be associated with the cursor.
  717.                                         A result table is created when a
  718.                                         query containing an SQL SELECT
  719.                                         statement is passed to
  720.                                         SqlExecute.
  721.  
  722.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  723.                                         Control Structure.  Any errors
  724.                                         that may occur cause the
  725.                                         szErrorDetail, szErrorMessage
  726.                                         and nResultCode fields of this
  727.                                         structure to be loaded with
  728.                                         descriptive information.
  729.  
  730.                          lpRecordBuffer LPSTR Points to a buffer
  731.                                         provided by the caller to
  732.                                         receive the formatted record.
  733.                                         This buffer must be at least as
  734.                                         large as the nRecordSize field
  735.                                         of SQLTABLE structure indicates.
  736.  
  737.           Return Value   The return value is 1 if no errors occurred and
  738.                          the table had at least one record, otherwise it
  739.                          is 0.
  740.  
  741.  
  742.  
  743.  
  744.  
  745.                                                    Functions: SqlFetchFirst
  746.           Quasar SQL API                                      Page 13 of 52
  747.  
  748.  
  749.           Comments       The usual procedure for using the SqlFetchFirst
  750.                          function is as follows:
  751.  
  752.                          1)   Set Data Format in the wFlags field of the
  753.                               lpSqlControl parameter to the option you
  754.                               intend to use.  If you have selected the
  755.                               mSqlFlagFormatPadded option, set the
  756.                               nPadding field of the lpSqlControl
  757.                               parameter to the number of spaces you want
  758.                               between fields.
  759.  
  760.                          2)   Call SqlExecute.
  761.  
  762.                          3)   Call SqlDescribeTable to determine the
  763.                               characteristics of the result table.  Of
  764.                               particular interest are the nRecordSize
  765.                               and lNumberOfRecords fields of the
  766.                               resultant SQLTABLE structure.
  767.  
  768.                          4)   If SqlTable.lNumberOfRecords indicates
  769.                               that one or more result table records are
  770.                               available, allocate a buffer sufficiently
  771.                               large (at least as large as
  772.                               SqlTable.nRecordSize) to receive the
  773.                               record's data.  Set the lpRecordBuffer
  774.                               parameter to point to this buffer and set
  775.                               the nRecordBufferSize field of the
  776.                               lpSqlControl parameter to the size of the
  777.                               buffer.
  778.  
  779.                          5)   Call SqlFetchFirst.
  780.  
  781.                          Once these steps are completed, you can make
  782.                          unlimited calls to any of the Quasar SQL API
  783.                          fetch functions without repeating steps (1)
  784.                          through (4).  The same lpRecordBuffer can be
  785.                          reused for all fetches.  Note, however, should
  786.                          you change the Data Format setting in the
  787.                          wFlags field of the lpSqlControl parameter, you
  788.                          must call SqlDescribeTable to calculate the new
  789.                          nRecordSize setting, reallocate the
  790.                          lpRecordBuffer and adjust the nRecordBufferSize
  791.                          field of the lpSqlControl parameter
  792.                          accordingly.
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.                                                    Functions: SqlFetchFirst
  808.           Quasar SQL API                                      Page 14 of 52
  809.  
  810.  
  811.                              Functions: SqlFetchLast
  812.  
  813.  
  814.           Syntax         BOOL FAR PASCAL SqlFetchLast(hUser, hCursor,
  815.                               lpSqlControl, lpRecordBuffer)
  816.  
  817.                          This function reads the last record in the
  818.                          result table associated with the hCursor
  819.                          parameter.  The data in this record is
  820.                          formatted and loaded into the buffer provided
  821.                          by the caller and pointed to by the
  822.                          lpRecordBuffer parameter.  To fetch this record
  823.                          you must have already logged in (SqlLogin),
  824.                          created a cursor (SqlCursorOpen) and executed a
  825.                          query (SqlExecute) which contained an SQL
  826.                          SELECT statement.
  827.  
  828.                          Parameter Type/Description
  829.  
  830.                          hUser          HANDLE Identifies the user who
  831.                                         owns the cursor.  The hUser
  832.                                         parameter must have been created
  833.                                         with the SqlLogin function.
  834.  
  835.                          hCursor        HANDLE Identifies the cursor
  836.                                         which owns the result table in
  837.                                         which the record exists.  The
  838.                                         hCursor parameter must have been
  839.                                         created with the SqlCursorOpen
  840.                                         function.  A result table must
  841.                                         be associated with the cursor.
  842.                                         A result table is created when a
  843.                                         query containing an SQL SELECT
  844.                                         statement is passed to
  845.                                         SqlExecute.
  846.  
  847.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  848.                                         Control Structure.  Any errors
  849.                                         that may occur cause the
  850.                                         szErrorDetail, szErrorMessage
  851.                                         and nResultCode fields of this
  852.                                         structure to be loaded with
  853.                                         descriptive information.
  854.  
  855.                          lpRecordBuffer LPSTR Points to a buffer
  856.                                         provided by the caller to
  857.                                         receive the formatted record.
  858.                                         This buffer must be at least as
  859.                                         large as the nRecordSize field
  860.                                         of SQLTABLE structure indicates.
  861.  
  862.           Return Value   The return value is 1 if no errors occurred and
  863.                          the table had at least one record, otherwise it
  864.                          is 0.
  865.  
  866.  
  867.  
  868.  
  869.                                                     Functions: SqlFetchLast
  870.           Quasar SQL API                                      Page 15 of 52
  871.  
  872.  
  873.           Comments       The usual procedure for using the SqlFetchLast
  874.                          function is as follows:
  875.  
  876.                          1)   Set Data Format in the wFlags field of the
  877.                               lpSqlControl parameter to the option you
  878.                               intend to use.  If you have selected the
  879.                               mSqlFlagFormatPadded option, set the
  880.                               nPadding field of the lpSqlControl
  881.                               parameter to the number of spaces you want
  882.                               between fields.
  883.  
  884.                          2)   Call SqlExecute.
  885.  
  886.                          3)   Call SqlDescribeTable to determine the
  887.                               characteristics of the result table.  Of
  888.                               particular interest are the nRecordSize
  889.                               and lNumberOfRecords fields of the
  890.                               resultant SQLTABLE structure.
  891.  
  892.                          4)   If SqlTable.lNumberOfRecords indicates
  893.                               that one or more result table records are
  894.                               available, allocate a buffer sufficiently
  895.                               large (at least as large as
  896.                               SqlTable.nRecordSize) to receive the
  897.                               record's data.  Set the lpRecordBuffer
  898.                               parameter to point to this buffer and set
  899.                               the nRecordBufferSize field of the
  900.                               lpSqlControl parameter to the size of the
  901.                               buffer.
  902.  
  903.                          5)   Call SqlFetchLast.
  904.  
  905.                          Once these steps are completed, you can make
  906.                          unlimited calls to any of the Quasar SQL API
  907.                          fetch functions without repeating steps (1)
  908.                          through (4).  The same lpRecordBuffer can be
  909.                          reused for all fetches.  Note, however, should
  910.                          you change the Data Format setting in the
  911.                          wFlags field of the lpSqlControl parameter, you
  912.                          must call SqlDescribeTable to calculate the new
  913.                          nRecordSize setting, reallocate the
  914.                          lpRecordBuffer and adjust the nRecordBufferSize
  915.                          field of the lpSqlControl parameter
  916.                          accordingly.
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.                                                     Functions: SqlFetchLast
  932.           Quasar SQL API                                      Page 16 of 52
  933.  
  934.  
  935.                              Functions: SqlFetchNext
  936.  
  937.  
  938.           Syntax         BOOL FAR PASCAL SqlFetchNext(hUser, hCursor,
  939.                               lpSqlControl, lpRecordBuffer)
  940.  
  941.                          This function reads the next record in the
  942.                          result table associated with the hCursor
  943.                          parameter.  The data in this record is
  944.                          formatted and loaded into the buffer provided
  945.                          by the caller and pointed to by the
  946.                          lpRecordBuffer parameter.  To fetch this record
  947.                          you must have already preformed at least one
  948.                          SqlFetchFirst or SqlFetchLast or
  949.                          SqlFetchPositioned function.
  950.  
  951.                          Parameter Type/Description
  952.  
  953.                          hUser          HANDLE Identifies the user who
  954.                                         owns the cursor.  The hUser
  955.                                         parameter must have been created
  956.                                         with the SqlLogin function.
  957.  
  958.                          hCursor        HANDLE Identifies the cursor
  959.                                         which owns the result table in
  960.                                         which the record exists.  The
  961.                                         hCursor parameter must have been
  962.                                         created with the SqlCursorOpen
  963.                                         function.  A result table must
  964.                                         be associated with the cursor.
  965.                                         A result table is created when a
  966.                                         query containing an SQL SELECT
  967.                                         statement is passed to
  968.                                         SqlExecute.
  969.  
  970.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  971.                                         Control Structure.  Any errors
  972.                                         that may occur cause the
  973.                                         szErrorDetail, szErrorMessage
  974.                                         and nResultCode fields of this
  975.                                         structure to be loaded with
  976.                                         descriptive information.
  977.  
  978.                          lpRecordBuffer LPSTR Points to a buffer
  979.                                         provided by the caller to
  980.                                         receive the formatted record.
  981.                                         This buffer must be at least as
  982.                                         large as the nRecordSize field
  983.                                         of SQLTABLE structure indicates.
  984.  
  985.           Return Value   The return value is 1 if no errors occurred and
  986.                          the cursor was not already positioned at the
  987.                          last record, otherwise it is 0.
  988.  
  989.  
  990.  
  991.  
  992.  
  993.                                                     Functions: SqlFetchNext
  994.           Quasar SQL API                                      Page 17 of 52
  995.  
  996.  
  997.           Comments       The same lpRecordBuffer can be reused for all
  998.                          fetches. Note, however, should you change the
  999.                          Data Format setting in the wFlags field of the
  1000.                          lpSqlControl parameter, you must call
  1001.                          SqlDescribeTable to calculate the new
  1002.                          nRecordSize setting, reallocate the
  1003.                          lpRecordBuffer and adjust the nRecordBufferSize
  1004.                          field of the lpSqlControl parameter
  1005.                          accordingly.
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.                                                     Functions: SqlFetchNext
  1056.           Quasar SQL API                                      Page 18 of 52
  1057.  
  1058.  
  1059.                           Functions: SqlFetchPositioned
  1060.  
  1061.  
  1062.           Syntax         BOOL FAR PASCAL SqlFetchPositioned(hUser,
  1063.                               hCursor, lpSqlControl, lRecordPosition,
  1064.                               lpRecordBuffer)
  1065.  
  1066.                          This function reads a record in the result
  1067.                          table associated with the hCursor parameter.
  1068.                          The lRecordPosition parameter indicates which
  1069.                          record is to be read.  When lRecordPosition is
  1070.                          '1', the first physical record is read; when
  1071.                          lRecordPosition is '2', the second physical
  1072.                          record is read and so on and so forth.  The
  1073.                          data in this record is formatted and loaded
  1074.                          into the buffer provided by the caller and
  1075.                          pointed to by the lpRecordBuffer parameter.  To
  1076.                          fetch this record you must have already logged
  1077.                          in (SqlLogin), created a cursor (SqlCursorOpen)
  1078.                          and executed a query (SqlExecute) which
  1079.                          contained an SQL SELECT statement.
  1080.  
  1081.                          Parameter Type/Description
  1082.  
  1083.                          hUser          HANDLE Identifies the user who
  1084.                                         owns the cursor.  The hUser
  1085.                                         parameter must have been created
  1086.                                         with the SqlLogin function.
  1087.  
  1088.                          hCursor        HANDLE Identifies the cursor
  1089.                                         which owns the result table in
  1090.                                         which the record exists.  The
  1091.                                         hCursor parameter must have been
  1092.                                         created with the SqlCursorOpen
  1093.                                         function.  A result table must
  1094.                                         be associated with the cursor.
  1095.                                         A result table is created when a
  1096.                                         query containing an SQL SELECT
  1097.                                         statement is passed to
  1098.                                         SqlExecute.
  1099.  
  1100.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  1101.                                         Control Structure.  Any errors
  1102.                                         that may occur cause the
  1103.                                         szErrorDetail, szErrorMessage
  1104.                                         and nResultCode fields of this
  1105.                                         structure to be loaded with
  1106.                                         descriptive information.
  1107.  
  1108.                          lRecordPosition     unsigned long Indicates
  1109.                                         which record is to be read.
  1110.  
  1111.                          lpRecordBuffer LPSTR Points to a buffer
  1112.                                         provided by the caller to
  1113.  
  1114.  
  1115.  
  1116.  
  1117.                                               Functions: SqlFetchPositioned
  1118.           Quasar SQL API                                      Page 19 of 52
  1119.  
  1120.  
  1121.                                         receive the formatted record.
  1122.                                         This buffer must be at least as
  1123.                                         large as the nRecordSize field
  1124.                                         of SQLTABLE structure indicates.
  1125.  
  1126.           Return Value   The return value is 1 if no errors occurred and
  1127.                          lRecordPosition is greater than zero and less
  1128.                          then or equal to the number of records in the
  1129.                          table, otherwise it is 0.
  1130.  
  1131.           Comments       Physical position is the raw position of the
  1132.                          record in the file.  Physical order is not the
  1133.                          same as the order you specify with the SQL
  1134.                          ORDER BY clause.
  1135.  
  1136.                          The usual procedure for using the
  1137.                          SqlFetchPositioned function is as follows:
  1138.  
  1139.                          1)   Set Data Format in the wFlags field of the
  1140.                               lpSqlControl parameter to the option you
  1141.                               intend to use.  If you have selected the
  1142.                               mSqlFlagFormatPadded option, set the
  1143.                               nPadding field of the lpSqlControl
  1144.                               parameter to the number of spaces you want
  1145.                               between fields.
  1146.  
  1147.                          2)   Call SqlExecute.
  1148.  
  1149.                          3)   Call SqlDescribeTable to determine the
  1150.                               characteristics of the result table.  Of
  1151.                               particular interest are the nRecordSize
  1152.                               and lNumberOfRecords fields of the
  1153.                               resultant SQLTABLE structure.
  1154.  
  1155.                          4)   If SqlTable.lNumberOfRecords indicates
  1156.                               that one or more result table records are
  1157.                               available, allocate a buffer sufficiently
  1158.                               large (at least as large as
  1159.                               SqlTable.nRecordSize) to receive the
  1160.                               record's data.  Set the lpRecordBuffer
  1161.                               parameter to point to this buffer and set
  1162.                               the nRecordBufferSize field of the
  1163.                               lpSqlControl parameter to the size of the
  1164.                               buffer.
  1165.  
  1166.                          5)   Call SqlFetchPositioned.
  1167.  
  1168.                          Once these steps are completed, you can make
  1169.                          unlimited calls to any of the Quasar SQL API
  1170.                          fetch functions without repeating steps (1)
  1171.                          through (4).  The same lpRecordBuffer can be
  1172.                          reused for all fetches.  Note, however, should
  1173.                          you change the Data Format setting in the
  1174.                          wFlags field of the lpSqlControl parameter, you
  1175.  
  1176.  
  1177.  
  1178.  
  1179.                                               Functions: SqlFetchPositioned
  1180.           Quasar SQL API                                      Page 20 of 52
  1181.  
  1182.  
  1183.                          must call SqlDescribeTable to calculate the new
  1184.                          nRecordSize setting, reallocate the
  1185.                          lpRecordBuffer and adjust the nRecordBufferSize
  1186.                          field of the lpSqlControl parameter
  1187.                          accordingly.
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.                                               Functions: SqlFetchPositioned
  1242.           Quasar SQL API                                      Page 21 of 52
  1243.  
  1244.  
  1245.                            Functions: SqlFetchPrevious
  1246.  
  1247.  
  1248.           Syntax         BOOL FAR PASCAL SqlFetchPrevious(hUser,
  1249.                               hCursor, lpSqlControl, lpRecordBuffer)
  1250.  
  1251.                          This function reads the previous record in the
  1252.                          result table associated with the hCursor
  1253.                          parameter.  The data in this record is
  1254.                          formatted and loaded into the buffer provided
  1255.                          by the caller and pointed to by the
  1256.                          lpRecordBuffer parameter.  To fetch this record
  1257.                          you must have already preformed at least one
  1258.                          SqlFetchFirst or SqlFetchLast or
  1259.                          SqlFetchPositioned function.
  1260.  
  1261.                          Parameter Type/Description
  1262.  
  1263.                          hUser          HANDLE Identifies the user who
  1264.                                         owns the cursor.  The hUser
  1265.                                         parameter must have been created
  1266.                                         with the SqlLogin function.
  1267.  
  1268.                          hCursor        HANDLE Identifies the cursor
  1269.                                         which owns the result table in
  1270.                                         which the record exists.  The
  1271.                                         hCursor parameter must have been
  1272.                                         created with the SqlCursorOpen
  1273.                                         function.  A result table must
  1274.                                         be associated with the cursor.
  1275.                                         A result table is created when a
  1276.                                         query containing an SQL SELECT
  1277.                                         statement is passed to
  1278.                                         SqlExecute.
  1279.  
  1280.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  1281.                                         Control Structure.  Any errors
  1282.                                         that may occur cause the
  1283.                                         szErrorDetail, szErrorMessage
  1284.                                         and nResultCode fields of this
  1285.                                         structure to be loaded with
  1286.                                         descriptive information.
  1287.  
  1288.                          lpRecordBuffer LPSTR Points to a buffer
  1289.                                         provided by the caller to
  1290.                                         receive the formatted record.
  1291.                                         This buffer must be at least as
  1292.                                         large as the nRecordSize field
  1293.                                         of SQLTABLE structure indicates.
  1294.  
  1295.           Return Value   The return value is 1 if no errors occurred and
  1296.                          the cursor was not already positioned at the
  1297.                          first record, otherwise it is 0.
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.                                                 Functions: SqlFetchPrevious
  1304.           Quasar SQL API                                      Page 22 of 52
  1305.  
  1306.  
  1307.           Comments       The same lpRecordBuffer can be reused for all
  1308.                          fetches. Note, however, should you change the
  1309.                          Data Format setting in the wFlags field of the
  1310.                          lpSqlControl parameter, you must call
  1311.                          SqlDescribeTable to calculate the new
  1312.                          nRecordSize setting, reallocate the
  1313.                          lpRecordBuffer and adjust the nRecordBufferSize
  1314.                          field of the lpSqlControl parameter
  1315.                          accordingly.
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.                                                 Functions: SqlFetchPrevious
  1366.           Quasar SQL API                                      Page 23 of 52
  1367.  
  1368.  
  1369.                              Functions: SqlGetStatus
  1370.  
  1371.  
  1372.           Syntax         BOOL FAR PASCAL SqlGetStatus(hUser, hCursor,
  1373.                               lpSqlControl, lpSqlStatus)
  1374.  
  1375.                          This function returns status information about
  1376.                          the most recent call to SqlExecute which used
  1377.                          the cursor indicated by the hCursor parameter.
  1378.                          Status information includes the number of
  1379.                          database records deleted, inserted, selected or
  1380.                          updated and the amount of time elapsed during
  1381.                          query execution.
  1382.  
  1383.                          If the hUser and hCursor parameters are set to
  1384.                          0, SqlGetStatus simply tests for the presence
  1385.                          of an active running Quasar Database
  1386.                          Administrator.  A value of 1 is returned if and
  1387.                          only if the database administrator is running.
  1388.  
  1389.                          Parameter Type/Description
  1390.  
  1391.                          hUser          HANDLE Identifies the user who
  1392.                                         owns the cursor.  The hUser
  1393.                                         parameter must have been created
  1394.                                         with the SqlLogin function.
  1395.  
  1396.                          hCursor        HANDLE Identifies the cursor for
  1397.                                         which the status is to be
  1398.                                         obtained.  The hCursor parameter
  1399.                                         must have been created with the
  1400.                                         SqlCursorOpen function.
  1401.  
  1402.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  1403.                                         Control Structure.  Any errors
  1404.                                         that may occur cause the
  1405.                                         szErrorDetail, szErrorMessage
  1406.                                         and nResultCode fields of this
  1407.                                         structure to be loaded with
  1408.                                         descriptive information.
  1409.  
  1410.                          lpSqlStatus    LPSQLSTATUS Points to the target
  1411.                                         SQL Status Structure.
  1412.  
  1413.           Return Value   The return value is 1 if no errors occurred,
  1414.                          otherwise it is 0.
  1415.  
  1416.           Comments       Each cursor's status information is reset every
  1417.                          time SqlExecute is called.
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.                                                     Functions: SqlGetStatus
  1428.           Quasar SQL API                                      Page 24 of 52
  1429.  
  1430.  
  1431.                                Functions: SqlLogin
  1432.  
  1433.  
  1434.           Syntax         HANDLE FAR PASCAL SqlLogin(lpSqlControl,
  1435.                               lpstrUserName, lpstrUserPassword)
  1436.  
  1437.                          In order to access the SQL Database
  1438.                          Administrator you must first identify yourself
  1439.                          as an user with sufficient privilege to access
  1440.                          the database.  This is accomplished by calling
  1441.                          the SqlLogin function with your user name and
  1442.                          password.  Once logged in, you can reference
  1443.                          all your tables without specifying an user
  1444.                          name. To reference another user's table you
  1445.                          must prefix the table name with the other
  1446.                          user's user name.  For example for user
  1447.                          "JohnDoe" to select all columns of the system
  1448.                          tables he must use:
  1449.  
  1450.                               SELECT * FROM SYSTEM.TABLES;
  1451.  
  1452.                          For user "SYSTEM" to select the "PartNumber"
  1453.                          column of user "JohnDoe"'s table "Inventory"
  1454.                          use the form:
  1455.  
  1456.                               SELECT JohnDoe.Inventory.PartNumber FROM
  1457.                                    JohnDoe.Inventory;
  1458.  
  1459.                          Or, more simply:
  1460.  
  1461.                               SELECT PartNumber FROM JohnDoe.Inventory;
  1462.  
  1463.                          Parameter Type/Description
  1464.  
  1465.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  1466.                                         Control Structure.  Any errors
  1467.                                         that may occur cause the
  1468.                                         szErrorDetail, szErrorMessage
  1469.                                         and nResultCode fields of this
  1470.                                         structure to be loaded with
  1471.                                         descriptive information.
  1472.  
  1473.                          lpstrUserName  LPSTR Points to a null
  1474.                                         terminated string containing the
  1475.                                         user name.
  1476.  
  1477.                          lpstrUserPassword   LPSTR Points to a null
  1478.                                         terminated string containing the
  1479.                                         user password.
  1480.  
  1481.           Return Value   The return value is an user handle if no errors
  1482.                          occurred while logging in, otherwise it is 0.
  1483.                          You must use this user handle in all calls to
  1484.                          the Quasar SQL API.
  1485.  
  1486.  
  1487.  
  1488.  
  1489.                                                         Functions: SqlLogin
  1490.           Quasar SQL API                                      Page 25 of 52
  1491.  
  1492.  
  1493.           Comments       Only those users recognized by the Quasar
  1494.                          Database Administrator will be allowed to log
  1495.                          in.  When first installed, the Quasar Database
  1496.                          Administrator only recognizes the user "SYSTEM"
  1497.                          whose password is "QUASAR". You can create
  1498.                          additional users by logging in as "SYSTEM" with
  1499.                          password "QUASAR" and granting connect
  1500.                          privileges to new users.
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.                                                         Functions: SqlLogin
  1552.           Quasar SQL API                                      Page 26 of 52
  1553.  
  1554.  
  1555.                                Functions: SqlLogout
  1556.  
  1557.  
  1558.           Syntax         BOOL FAR PASCAL SqlLogout(hUser, lpSqlControl)
  1559.  
  1560.                          This function logs the user off the system.  If
  1561.                          the Automatic Commit option flag is set in the
  1562.                          wFlags field of the lpSqlControl parameter, any
  1563.                          transaction still in progress is automatically
  1564.                          committed; otherwise, all work performed by the
  1565.                          user since logging in or since the last COMMIT
  1566.                          WORK query (whichever occurred last) is rolled
  1567.                          back.
  1568.  
  1569.                          Parameter Type/Description
  1570.  
  1571.                          hUser          HANDLE Identifies the user who
  1572.                                         wishes to log off.  The hUser
  1573.                                         parameter must have been created
  1574.                                         with the SqlLogin function.
  1575.  
  1576.                          lpSqlControl   LPSQLCONTROL Points to an SQL
  1577.                                         Control Structure.  Any errors
  1578.                                         that may occur cause the
  1579.                                         szErrorDetail, szErrorMessage
  1580.                                         and nResultCode fields of this
  1581.                                         structure to be loaded with
  1582.                                         descriptive information.
  1583.  
  1584.           Return Value   The return value is 1 if no errors occurred,
  1585.                          otherwise it is 0.
  1586.  
  1587.           Comments       While SqlLogout automatically closes all the
  1588.                          user's cursor before logging the user off, we
  1589.                          recommend explicitly closing cursor when they
  1590.                          are no longer needed.
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.                                                        Functions: SqlLogout
  1614.           Quasar SQL API                                      Page 27 of 52
  1615.  
  1616.  
  1617.                                     Constants
  1618.  
  1619.  
  1620.           This section includes a formal description of all constants
  1621.           defined in the Quasar SQL API include file for 'C' and the
  1622.           global file for 'Visual Basic'.
  1623.  
  1624.           Be sure to use the values by name as the numeric values may
  1625.           (and probably will) change in the next release of the Quasar
  1626.           SQL API.
  1627.  
  1628.           Data Class          Identifies the general characteristics of
  1629.                               a column in the result table
  1630.  
  1631.           Data Type           Identifies the particular characteristics
  1632.                               of a column in the result table
  1633.  
  1634.           Data Format         Instructs the Quasar SQL API as to the
  1635.                               format of the returned data in the result
  1636.                               table
  1637.  
  1638.           Automatic Commit    Instructs the Quasar SQL API whether to
  1639.                               commit or roll back any pending
  1640.                               transaction at user log out
  1641.  
  1642.           Key Size            Defines the maximum length of an index.
  1643.  
  1644.           Name Length         Defines the maximum length of user, table
  1645.                               and column names
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.                                                                   Constants
  1676.           Quasar SQL API                                      Page 28 of 52
  1677.  
  1678.  
  1679.                               Constants: Data Class
  1680.  
  1681.  
  1682.           The following constants identify the general characteristics
  1683.           of a column in the result table.  The nDataClass field of the
  1684.           SQLCOLUMN data structure is set to one of these values as a
  1685.           result of an SqlDescribeColumn function call.
  1686.  
  1687.           mSqlDataClassAPPROXIMATE Indicates that the column is one of
  1688.                                    the approximate numeric data types
  1689.  
  1690.           mSqlDataClassBINARY      Indicates that the column is of the
  1691.                                    binary data type
  1692.  
  1693.           mSqlDataClassCHAR        Indicates that the column is one of
  1694.                                    the character string data types
  1695.  
  1696.           mSqlDataClassEXACT       Indicates that the column is one of
  1697.                                    the exact numeric data types
  1698.  
  1699.           mSqlDataClassINVALID     Indicates that the data type of the
  1700.                                    column is invalid
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.                                                       Constants: Data Class
  1738.           Quasar SQL API                                      Page 29 of 52
  1739.  
  1740.  
  1741.                                Constants: Data Type
  1742.  
  1743.  
  1744.           The following constants identify the particular
  1745.           characteristics of a column in the result table.  The
  1746.           nDataType field of the SQLCOLUMN data structure is set to one
  1747.           of these values as a result of an SqlDescribeColumn function
  1748.           call.
  1749.  
  1750.           mSqlDataTypeBINARY       Indicates that the data type of the
  1751.                                    column is BINARY: its length is given
  1752.                                    by the nPrecision field of the
  1753.                                    SQLCOLUMN data structure
  1754.  
  1755.           mSqlDataTypeCHAR         Indicates that the data type of the
  1756.                                    column is CHAR: its length is given
  1757.                                    by the nPrecision field of the
  1758.                                    SQLCOLUMN data structure
  1759.  
  1760.           mSqlDataTypeDECIMAL      Indicates that the data type of the
  1761.                                    column is DECIMAL: its precision and
  1762.                                    scale are given by the nPrecision and
  1763.                                    nScale fields of the SQLCOLUMN data
  1764.                                    structure
  1765.  
  1766.           mSqlDataTypeDOUBLE       Indicates that the data type of the
  1767.                                    column is DOUBLE PRECISION: its
  1768.                                    precision is given by the nPrecision
  1769.                                    field of the SQLCOLUMN data structure
  1770.  
  1771.           mSqlDataTypeFLOAT        Indicates that the data type of the
  1772.                                    column is FLOAT: its precision is
  1773.                                    given by the nPrecision field of the
  1774.                                    SQLCOLUMN data structure
  1775.  
  1776.           mSqlDataTypeINTEGER      Indicates that the data type of the
  1777.                                    column is INTEGER: its precision is
  1778.                                    given by the nPrecision field of the
  1779.                                    SQLCOLUMN data structure
  1780.  
  1781.           mSqlDataTypeNUMERIC      Indicates that the data type of the
  1782.                                    column is NUMERIC: its precision and
  1783.                                    scale are given by the nPrecision and
  1784.                                    nScale fields of the SQLCOLUMN data
  1785.                                    structure
  1786.  
  1787.           mSqlDataTypeREAL         Indicates that the data type of the
  1788.                                    column is REAL: its precision is
  1789.                                    given by the nPrecision field of the
  1790.                                    SQLCOLUMN data structure
  1791.  
  1792.           mSqlDataTypeSMALLINT     Indicates that the data type of the
  1793.                                    column is SMALLINT: its precision is
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.                                                        Constants: Data Type
  1800.           Quasar SQL API                                      Page 30 of 52
  1801.  
  1802.  
  1803.                                    given by the nPrecision field of the
  1804.                                    SQLCOLUMN data structure
  1805.  
  1806.           mSqlDataTypeVARCHAR      Indicates that the data type of the
  1807.                                    column is VARCHAR: its maximum length
  1808.                                    is given by the nPrecision field of
  1809.                                    the SQLCOLUMN data structure
  1810.  
  1811.           mSqlDataTypeINVALID      Indicates that the data type of the
  1812.                                    column is invalid
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.                                                        Constants: Data Type
  1862.           Quasar SQL API                                      Page 31 of 52
  1863.  
  1864.  
  1865.                               Constants: Data Format
  1866.  
  1867.  
  1868.           When a record is fetched from the result table by means of one
  1869.           of the SqlFetch functions, the Quasar SQL API loads the record
  1870.           into a buffer provided by the user.  The record is returned in
  1871.           one of three optional formats.  The user selects the format he
  1872.           wants by setting the wFlags field of the SQLCONTROL structure
  1873.           to one (and only one) of the following values:
  1874.  
  1875.           mSqlFlagFormatPadded     The record is returned as a single
  1876.                                    null terminated character string.
  1877.                                    The data for each column is contained
  1878.                                    within this string separated by
  1879.                                    spaces.  The number of spaces is set
  1880.                                    by the user in the nPadding field of
  1881.                                    the SQLCONTROL structure.  The length
  1882.                                    of the string is constant across all
  1883.                                    records and is available to the user
  1884.                                    in the nRecordSize field of the
  1885.                                    SQLTABLE data structure. The length
  1886.                                    of each column's portion of the
  1887.                                    string is available to the user in
  1888.                                    the nFieldWidth field of the
  1889.                                    SQLCOLUMN data structure.
  1890.  
  1891.           mSqlFlagFormatString     The record is returned as a set of
  1892.                                    null terminated character strings,
  1893.                                    one for each column. The first
  1894.                                    column's string is loaded into the
  1895.                                    first bytes of the record buffer. The
  1896.                                    second column's string immediately
  1897.                                    follows the first and so on.  Each
  1898.                                    string contains only the minimum
  1899.                                    number of characters to represent the
  1900.                                    data. That is, the strings are not
  1901.                                    padded.
  1902.  
  1903.           mSqlFlagFormatStructure  The record is returned as a packed
  1904.                                    'C' data structure.  This format is
  1905.                                    not recommended for 'Visual Basic'
  1906.                                    users. Fields appear in the 'C' data
  1907.                                    structure in the same order in which
  1908.                                    they appear in the result table.
  1909.                                    Character types are converted to null
  1910.                                    terminated character strings padded
  1911.                                    with spaces to bring them to the
  1912.                                    length of nFieldWidth as found in the
  1913.                                    SQLCOLUMN data structure.
  1914.                                    Approximate and exact numeric types
  1915.                                    are converted to their 'double'
  1916.                                    representation.  A record containing
  1917.                                    three fields: CHAR (10), INTEGER,
  1918.                                    DECIMAL(7,2) would appear as:
  1919.  
  1920.  
  1921.  
  1922.  
  1923.                                                      Constants: Data Format
  1924.           Quasar SQL API                                      Page 32 of 52
  1925.  
  1926.  
  1927.                                         struct {
  1928.                                           char    szField1[11];
  1929.                                           double  dField2;
  1930.                                           double  dField3;
  1931.                                         }
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.                                                      Constants: Data Format
  1986.           Quasar SQL API                                      Page 33 of 52
  1987.  
  1988.  
  1989.  
  1990.  
  1991.                Constants: Automatic Commit, Key Size & Name Length
  1992.  
  1993.  
  1994.           When a query is executed via an SqlExecute call, it is not
  1995.           committed and will be rolled back if the user should happen to
  1996.           log off.
  1997.  
  1998.           mSqlFlagAutoCommitOnLogout Setting this bit of the wFlags
  1999.                                    field of the SQLCONTROL structure
  2000.                                    tells the Quasar SQL API to issue a
  2001.                                    commit command to the database
  2002.                                    administrator prior to logging the
  2003.                                    user off.  This flag may be set in
  2004.                                    combination (using the '|' operator)
  2005.                                    with any one of Data Format flags.
  2006.  
  2007.           While indices can be constructed from any number of columns:
  2008.           the total length of the key is limited.
  2009.  
  2010.           mSqlMaximumKeySize       This is the maximum of characters
  2011.                                    allowed in any single index.
  2012.  
  2013.           While character string fields may be quite lengthy: names of
  2014.           users, tables and columns are limited.
  2015.  
  2016.           mSqlMaximumNameLength    This is the maximum length (not
  2017.                                    including the null terminator) of
  2018.                                    names of users, tables and columns.
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.                         Constants: Automatic Commit, Key Size & Name Length
  2048.           Quasar SQL API                                      Page 34 of 52
  2049.  
  2050.  
  2051.                                  Data Structures
  2052.  
  2053.  
  2054.           This section includes a formal description of all data
  2055.           structures which your program will use when it communicates
  2056.           with the Quasar SQL API.  Typedefs for all these structures
  2057.           can be found in the Quasar SQL API include file for 'C'.
  2058.           Declarations can be found in the global file for 'Visual
  2059.           Basic'.
  2060.  
  2061.           SQLCOLUMN           The data structure which describes a
  2062.                               column in the result table which was
  2063.                               generated by execution of a query
  2064.  
  2065.           SQLCONTROL          The data structure which contains
  2066.                               information needed by the Quasar SQL API
  2067.                               to perform its functions and which passes
  2068.                               process information back to the user
  2069.  
  2070.           SQLSTATUS           The data structure with gives the user
  2071.                               access to operational information
  2072.  
  2073.           SQLTABLE            The data structure which describes the
  2074.                               result table which was generated by
  2075.                               execution of a query
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.                                                             Data Structures
  2110.           Quasar SQL API                                      Page 35 of 52
  2111.  
  2112.  
  2113.                             Data Structures: SQLCOLUMN
  2114.  
  2115.  
  2116.                       Result Table Column Description Record
  2117.  
  2118.  
  2119.           The SQLCOLUMN data structure describes the characteristics of
  2120.           a specified column of the result table.  The SQLCOLUMN data
  2121.           structure is loaded as a result of an SqlDescribeColumn
  2122.           function call.
  2123.  
  2124.                     typedef struct tagSQLCOLUMN {
  2125.                       BOOL      bRightJustified;
  2126.                       char      szColumnName[mSqlMaximumNameLength+1];
  2127.                       unsigned  nColumnSequenceNumber;
  2128.                       unsigned  nDataClass;
  2129.                       unsigned  nDataType;
  2130.                       unsigned  nFieldWidth;
  2131.                       unsigned  nPrecision;
  2132.                       unsigned  nScale;
  2133.                     } SQLCOLUMN;
  2134.                     typedef SQLCOLUMN *PSQLCOLUMN;
  2135.                     typedef SQLCOLUMN far *LPSQLCOLUMN;
  2136.  
  2137.           The SQLCOLUMN data structure has the following fields:
  2138.  
  2139.           bRightJustified          Indicates whether the column, by
  2140.                                    default, is left or right justified.
  2141.                                    Right justification is indicated by a
  2142.                                    a non-zero value.
  2143.  
  2144.           szColumnName             Gives the column heading as a null
  2145.                                    terminated text string.
  2146.  
  2147.           nColumnSequenceNumber    Column numbers range from 1 to the
  2148.                                    number of columns in the result
  2149.                                    table.
  2150.  
  2151.           nDataClass               Identifies the general
  2152.                                    characteristics of a column in the
  2153.                                    result table.  Its value will be set
  2154.                                    to one of the Data Class constants.
  2155.  
  2156.           nDataType                Identifies the particular
  2157.                                    characteristics of a column in the
  2158.                                    result table.  Its value will be set
  2159.                                    to one of the Data Type constants.
  2160.  
  2161.           nFieldWidth              The number of character positions
  2162.                                    guaranteed to hold the value of this
  2163.                                    column when the record is fetched.
  2164.                                    If Data Format in the wFlags field of
  2165.                                    the lpSqlControl is
  2166.                                    mSqlFlagFormatPadded: nFieldWidth is
  2167.  
  2168.  
  2169.  
  2170.  
  2171.                                                  Data Structures: SQLCOLUMN
  2172.           Quasar SQL API                                      Page 36 of 52
  2173.  
  2174.  
  2175.                                    set to the size of the column.  If
  2176.                                    Data Format is mSqlFlagFormatString:
  2177.                                    nFieldWidth is set to the size of the
  2178.                                    column plus one for the terminating
  2179.                                    null. If Data Format is
  2180.                                    mSqlFlagFormatStructure and the
  2181.                                    column is numeric: nFieldWidth is set
  2182.                                    to sizeof(double), if the column is a
  2183.                                    character string type: nFieldWidth is
  2184.                                    set to the size of the column plus
  2185.                                    one for the terminating null.
  2186.  
  2187.           nPrecision               If a numeric column, nPrecision is
  2188.                                    set to the precision (as defined by
  2189.                                    ANSI SQL) of the result.  If a
  2190.                                    character field, nPrecision is set to
  2191.                                    the length (as defined by ANSI SQL)
  2192.                                    of the result.
  2193.  
  2194.           nScale                   If a numeric column, nScale is set to
  2195.                                    the scale (as defined by ANSI SQL) of
  2196.                                    the result.  If a character field,
  2197.                                    nScale is 0.
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.                                                  Data Structures: SQLCOLUMN
  2234.           Quasar SQL API                                      Page 37 of 52
  2235.  
  2236.  
  2237.                            Data Structures: SQLCONTROL
  2238.  
  2239.  
  2240.                     Quasar SQL API Interface Control Structure
  2241.  
  2242.  
  2243.           The SQLCONTROL data structure contains the specifications
  2244.           necessary to provide an interface between the applications
  2245.           programmer and the Quasar SQL API.
  2246.  
  2247.                     typedef struct tagSQLCONTROL {
  2248.                       char      szErrorDetail[65];
  2249.                       char      szErrorMessage[257];
  2250.                       unsigned  nHiLiteLength;
  2251.                       unsigned  nHiLiteOffset;
  2252.                       unsigned  nPadding;
  2253.                       unsigned  nRecordBufferSize;
  2254.                       unsigned  nResultCode;
  2255.                       unsigned long lRecordPosition;
  2256.                       unsigned long lReserved0
  2257.                       unsigned long lReserved1
  2258.                       unsigned long lReserved2
  2259.                       unsigned long lReserved3
  2260.                       unsigned long lReserved4
  2261.                       WORD      wFlags;
  2262.                     } SQLCONTROL;
  2263.                     typedef SQLCONTROL *PSQLCONTROL;
  2264.                     typedef SQLCONTROL far *LPSQLCONTROL;
  2265.  
  2266.           The SQLCONTROL data structure has the following fields:
  2267.  
  2268.           szErrorDetail            Each time an Quasar SQL API function
  2269.                                    is called, any errors that may occur
  2270.                                    cause this field to be loaded with a
  2271.                                    descriptive string: "Error detected
  2272.                                    at line n of module.c".  This
  2273.                                    information is useful if you need to
  2274.                                    call customer service.
  2275.  
  2276.           szErrorMessage           Each time an Quasar SQL API function
  2277.                                    is called, any errors that may occur
  2278.                                    cause this field to be loaded with a
  2279.                                    descriptive string: "ERROR xxx:
  2280.                                    text." This provides a useful
  2281.                                    diagnostic while you are debugging
  2282.                                    your application. "xxx" is the ASCII
  2283.                                    representation (base 10) of the
  2284.                                    nResultCode.
  2285.  
  2286.           nHiLiteLength            Each time the SqlExecute is called,
  2287.                                    any syntax errors within the query
  2288.                                    cause this field to be set to the
  2289.                                    length of the offending phrase within
  2290.                                    the query text.
  2291.  
  2292.  
  2293.  
  2294.  
  2295.                                                 Data Structures: SQLCONTROL
  2296.           Quasar SQL API                                      Page 38 of 52
  2297.  
  2298.  
  2299.           nHiLiteOffset            Each time the SqlExecute is called,
  2300.                                    any syntax errors within the query
  2301.                                    cause this field to be set to the
  2302.                                    offset of the offending phrase within
  2303.                                    the query text.
  2304.  
  2305.           nPadding                 The caller of the Quasar SQL API sets
  2306.                                    this field to the number of padding
  2307.                                    spaces to be inserted between columns
  2308.                                    when the wFlags field of the
  2309.                                    SQLCONTROL structure is set to
  2310.                                    mSqlFlagFormatPadded.
  2311.  
  2312.           nRecordBufferSize        The caller of the Quasar SQL API sets
  2313.                                    this field to the size (in bytes) of
  2314.                                    the record buffer.  This buffer must
  2315.                                    be at least as large as the value in
  2316.                                    the nRecordSize field of the SQLTABLE
  2317.                                    data structure.  The SQLTABLE data
  2318.                                    structure is available by calling
  2319.                                    SqlDescribeTable.
  2320.  
  2321.           nResultCode              Indicates the basic status condition
  2322.                                    after any call to an Quasar SQL API
  2323.                                    function.  A value of 0 indicates no
  2324.                                    error.  Other values are listed under
  2325.                                    Result Codes
  2326.  
  2327.           lRecordPosition          Indicates the position within the
  2328.                                    result table of the most recent
  2329.                                    record fetched. lRecordPosition can
  2330.                                    range from 1 to the number of records
  2331.                                    in the result table. If
  2332.                                    lRecordPosition is 0 then no records
  2333.                                    have been fetched.
  2334.  
  2335.           lReserved0               Do not tamper with this field.
  2336.  
  2337.           lReserved1               Do not tamper with this field.
  2338.  
  2339.           lReserved2               Do not tamper with this field.
  2340.  
  2341.           lReserved3               Do not tamper with this field.
  2342.  
  2343.           lReserved4               Do not tamper with this field.
  2344.  
  2345.           wFlags                   The caller of the Quasar SQL API sets
  2346.                                    this field to the desired Data Format
  2347.                                    to be utilized during record fetch
  2348.                                    functions.  The data format may be
  2349.                                    optionally combined using the '|'
  2350.                                    operator with the Automatic Commit
  2351.                                    flag.
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.                                                 Data Structures: SQLCONTROL
  2358.           Quasar SQL API                                      Page 39 of 52
  2359.  
  2360.  
  2361.                             Data Structures: SQLSTATUS
  2362.  
  2363.  
  2364.                               Query Status Structure
  2365.  
  2366.  
  2367.           The SQLSTATUS data structure describes the overall outcome of
  2368.           the most recent SqlExecute operation for a given cursor.
  2369.  
  2370.                     typedef struct tagSQLSTATUS {
  2371.                     unsigned long lNumberOfRecordDeletes;
  2372.                     unsigned long lNumberOfRecordInserts;
  2373.                     unsigned long lNumberOfRecordSelects;
  2374.                     unsigned long lNumberOfRecordUpdates;
  2375.                     unsigned long lTimeElapsed;
  2376.                     } SQLSTATUS;
  2377.                     typedef SQLSTATUS *PSQLSTATUS;
  2378.                     typedef SQLSTATUS far *LPSQLSTATUS;
  2379.  
  2380.           The SQLSTATUS data structure has the following fields:
  2381.  
  2382.           lNumberOfRecordDeletes   Indicates the total number of records
  2383.                                    deleted by the most recent
  2384.                                    SqlExecute.
  2385.  
  2386.           lNumberOfRecordInserts   Indicates the total number of records
  2387.                                    inserted by the most recent
  2388.                                    SqlExecute.
  2389.  
  2390.           lNumberOfRecordSelects   Indicates the total number of records
  2391.                                    selected by the most recent
  2392.                                    SqlExecute.
  2393.  
  2394.           lNumberOfRecordUpdates   Indicates the total number of records
  2395.                                    updated by the most recent
  2396.                                    SqlExecute.
  2397.  
  2398.           lTimeElapsed             Indicates the time elapsed (in
  2399.                                    milliseconds) during the most recent
  2400.                                    SqlExecute.
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.                                                  Data Structures: SQLSTATUS
  2420.           Quasar SQL API                                      Page 40 of 52
  2421.  
  2422.  
  2423.                             Data Structures: SQLTABLE
  2424.  
  2425.  
  2426.                          Result Table Description Record
  2427.  
  2428.  
  2429.           The SQLTABLE data structure describes the characteristics of
  2430.           the result table. The SQLTABLE data structure is loaded as a
  2431.           result of an SqlDescribeTable function call.
  2432.  
  2433.                     typedef struct tagSQLTABLE {
  2434.                     unsigned    nNumberOfColumns;
  2435.                     unsigned    nRecordSize;
  2436.                     unsigned long lNumberOfRecords;
  2437.                     } SQLTABLE;
  2438.                     typedef SQLTABLE *PSQLTABLE;
  2439.                     typedef SQLTABLE far *LPSQLTABLE;
  2440.  
  2441.           The SQLTABLE data structure has the following fields:
  2442.  
  2443.           nNumberOfColumns         Indicates the number of columns in
  2444.                                    the result table.
  2445.  
  2446.           nRecordSize              Indicates the minimum size (in bytes)
  2447.                                    of a buffer large enough to hold a
  2448.                                    record fetched from the result table.
  2449.  
  2450.           lNumberOfRecords         Indicates the number of records in
  2451.                                    the result table.
  2452.  
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.                                                   Data Structures: SQLTABLE
  2482.           Quasar SQL API                                      Page 41 of 52
  2483.  
  2484.  
  2485.                                    Result Codes
  2486.  
  2487.  
  2488.           This section gives an explanation of all result codes returned
  2489.           by the Quasar SQL API.  Macro definitions for all result codes
  2490.           can be found in the Quasar SQL API include file for 'C'.
  2491.           Global Const definitions can be found in the global file for
  2492.           'Visual Basic'.
  2493.  
  2494.           mSqlErrorAmbiguousColumn When a column name can be found in
  2495.                                    more than one of several tables given
  2496.                                    in the "FROM" clause of a query, the
  2497.                                    database administrator cannot
  2498.                                    determine which of them you mean.  To
  2499.                                    remove the ambiguity, use the
  2500.                                    "Tablename.ColumnName" or the
  2501.                                    "UserName.Tablename.ColumnName"
  2502.                                    syntax.
  2503.  
  2504.           mSqlErrorBadEnvironment  The DatabasePath or LogPath entry in
  2505.                                    the "win.ini" file is not properly
  2506.                                    specified: it must begin with a drive
  2507.                                    identifier followed by a ':' and a
  2508.                                    '\'.  A typical entry is
  2509.                                    "c:\database".  Any directory must
  2510.                                    already exist.
  2511.  
  2512.           mSqlErrorBinaryNotAllowed When creating a table, the data type
  2513.                                    BINARY was specified, the BINARY data
  2514.                                    type is not allowed in this release.
  2515.  
  2516.           mSqlErrorCannotActivateFile An attempt has been made to access
  2517.                                    a file which is unrecognized by the
  2518.                                    b-tree file manager.  This is an
  2519.                                    internal error which should never
  2520.                                    occur. Please contact customer
  2521.                                    service.
  2522.  
  2523.           mSqlErrorCannotCloseFile When the b-tree file manager
  2524.                                    attempted to close either a data file
  2525.                                    or an index file, _lclose() returned
  2526.                                    an error.  This usually indicates a
  2527.                                    problem with the DOS directory
  2528.                                    structure, we recommend you run
  2529.                                    'chkdsk'.
  2530.  
  2531.           mSqlErrorCannotCloseLog When the database manager attempted to
  2532.                                    close either the 'or_log.dat' or the
  2533.                                    'or_log.idx' transaction journal
  2534.                                    file, _lclose() returned an error.
  2535.                                    This usually indicates a problem with
  2536.                                    the DOS directory structure, we
  2537.                                    recommend you run 'chkdsk'.
  2538.  
  2539.  
  2540.  
  2541.  
  2542.  
  2543.                                                                Result Codes
  2544.           Quasar SQL API                                      Page 42 of 52
  2545.  
  2546.  
  2547.           mSqlErrorCannotCreateDataFile When the b-tree file manager
  2548.                                    attempted to create a data file,
  2549.                                    _lcreat() returned an error.  This
  2550.                                    usually indicates your setting for
  2551.                                    'FILES' in the 'config.sys' file
  2552.                                    should be increased.
  2553.  
  2554.           mSqlErrorCannotCreateDumpFile When the dump manager attempted
  2555.                                    to create a dump file, _lcreat()
  2556.                                    returned an error.  This usually
  2557.                                    indicates your setting for 'FILES' in
  2558.                                    the 'config.sys' file should be
  2559.                                    increased.
  2560.  
  2561.           mSqlErrorCannotCreateFile This result code will not occur.
  2562.  
  2563.           mSqlErrorCannotCreateKeyFile When the b-tree file manager
  2564.                                    attempted to create a key file,
  2565.                                    _lcreat() returned an error.  This
  2566.                                    usually indicates your setting for
  2567.                                    'FILES' in the 'config.sys' file
  2568.                                    should be increased.
  2569.  
  2570.           mSqlErrorCannotCreateLog When the database manager attempted
  2571.                                    to create either the 'or_log.dat' or
  2572.                                    the 'or_log.idx' transaction journal
  2573.                                    file, _lcreat() returned an error.
  2574.                                    This usually indicates your setting
  2575.                                    for 'FILES' in the 'config.sys' file
  2576.                                    should be increased.
  2577.  
  2578.           mSqlErrorCannotDeleteFile When the b-tree file manager
  2579.                                    attempted to remove either a data
  2580.                                    file or a key file, remove() returned
  2581.                                    an error.  This usually indicates
  2582.                                    someone has modified the file's
  2583.                                    attribute settings.  Please be sure
  2584.                                    none of the database files are marked
  2585.                                    as 'read only', 'hidden' or 'system'.
  2586.  
  2587.           mSqlErrorCannotDropSystemAdmin Connection privileges cannot be
  2588.                                    revoked from the system
  2589.                                    administrator.
  2590.  
  2591.           mSqlErrorCannotDropTable When the database manager attempted
  2592.                                    to drop a table, its 'use count' was
  2593.                                    greater than zero! This is an
  2594.                                    internal error which should never
  2595.                                    occur.  Please contact customer
  2596.                                    service.
  2597.  
  2598.           mSqlErrorCannotOpenDataFile When the b-tree file manager
  2599.                                    attempted to open a data file,
  2600.                                    _lopen() returned an error.  This
  2601.  
  2602.  
  2603.  
  2604.  
  2605.                                                                Result Codes
  2606.           Quasar SQL API                                      Page 43 of 52
  2607.  
  2608.  
  2609.                                    usually indicates someone has
  2610.                                    modified the file's attribute
  2611.                                    settings or deleted the file.  Please
  2612.                                    be sure none of the database files
  2613.                                    are marked as 'read only', 'hidden'
  2614.                                    or 'system'.  Also, delete files only
  2615.                                    via SQL.
  2616.  
  2617.           mSqlErrorCannotOpenFile  This result code will not occur.
  2618.  
  2619.           mSqlErrorCannotOpenKeyFile When the b-tree file manager
  2620.                                    attempted to open a key file,
  2621.                                    _lopen() returned an error.  This
  2622.                                    usually indicates someone has
  2623.                                    modified the file's attribute
  2624.                                    settings or deleted the file.  Please
  2625.                                    be sure none of the database files
  2626.                                    are marked as 'read only', 'hidden'
  2627.                                    or 'system'.  Also, delete files only
  2628.                                    via SQL.
  2629.  
  2630.           mSqlErrorCannotOpenLog   When the database manager attempted
  2631.                                    to open either the 'or_log.dat' or
  2632.                                    the 'or_log.idx' transaction journal
  2633.                                    file, _lopen() returned an error.
  2634.                                    This usually indicates your setting
  2635.                                    for 'FILES' in the 'config.sys' file
  2636.                                    should be increased.
  2637.  
  2638.           mSqlErrorCannotRemoveTable When the database manager attempted
  2639.                                    to delete a file during a 'Toolbox
  2640.                                    Remove' database operation, remove()
  2641.                                    returned an error.  This usually
  2642.                                    indicates someone has modified the
  2643.                                    file's attribute settings.  Please be
  2644.                                    sure none of the database files are
  2645.                                    marked as 'read only', 'hidden' or
  2646.                                    'system'.
  2647.  
  2648.           mSqlErrorCannotRevokeByColumn While the privilege to update
  2649.                                    can be restricted to specific
  2650.                                    columns, this privilege can only be
  2651.                                    revoked on the entire table: a column
  2652.                                    list may not be specified in the
  2653.                                    revoke statement.
  2654.  
  2655.           mSqlErrorCharNotAllowed  When the bind manager attempted to
  2656.                                    initialize an AVG() or SUM() set
  2657.                                    function, it discovered that the
  2658.                                    argument was a CHAR or VARCHAR
  2659.                                    column!
  2660.  
  2661.           mSqlErrorCheckpointDetected This result code will not occur.
  2662.  
  2663.  
  2664.  
  2665.  
  2666.  
  2667.                                                                Result Codes
  2668.           Quasar SQL API                                      Page 44 of 52
  2669.  
  2670.  
  2671.           mSqlErrorDataFileCorrupted The b-tree file manager encountered
  2672.                                    illegal settings in the header
  2673.                                    portions of a data file.  It is
  2674.                                    likely that your DOS files are
  2675.                                    corrupted.
  2676.  
  2677.           mSqlErrorDatabaseCorrupt The database manager encountered
  2678.                                    illegal settings in the header
  2679.                                    portions of the transaction journal
  2680.                                    file.  It is likely that your DOS
  2681.                                    files are corrupted.
  2682.  
  2683.           mSqlErrorDbaNotAvailable The Quasar SQL API could not
  2684.                                    establish communication with the
  2685.                                    Quasar Database Administrator.  Is
  2686.                                    the database administrator running?
  2687.  
  2688.           mSqlErrorDivideByZero    During query execution a divide by
  2689.                                    zero error occurred.
  2690.  
  2691.           mSqlErrorDuplicateColumn During query execution a column is
  2692.                                    called out more than once in a list
  2693.                                    where it can appear only once.  This
  2694.                                    can only occur in the CREATE TABLE
  2695.                                    statement and the INSERT statement.
  2696.  
  2697.           mSqlErrorDuplicateRecord The b-tree file manager detected an
  2698.                                    attempt to violate an UNIQUE
  2699.                                    constraint.
  2700.  
  2701.           mSqlErrorExistingDataFile When the b-tree file manager
  2702.                                    attempted to create a data file, it
  2703.                                    discovered the file already existed!
  2704.                                    Delete files only via SQL.
  2705.  
  2706.           mSqlErrorExistingKeyFile When the b-tree file manager
  2707.                                    attempted to create a key file, it
  2708.                                    discovered the file already existed!
  2709.                                    Delete files only via SQL.
  2710.  
  2711.           mSqlErrorFileReadFailed  When the b-tree file manager
  2712.                                    attempted to read a file, _lread()
  2713.                                    returned an error.
  2714.  
  2715.           mSqlErrorFileSeekFailed  When the b-tree file manager
  2716.                                    attempted to seek a position in a
  2717.                                    file, _llseek() returned an error.
  2718.  
  2719.           mSqlErrorFileWriteFailed When the b-tree file manager
  2720.                                    attempted to write a file, _lwrite()
  2721.                                    returned an error.
  2722.  
  2723.  
  2724.  
  2725.  
  2726.  
  2727.  
  2728.  
  2729.                                                                Result Codes
  2730.           Quasar SQL API                                      Page 45 of 52
  2731.  
  2732.  
  2733.           mSqlErrorGlobalAllocFailed When the lock manager attempted to
  2734.                                    allocate global memory, GlobalAlloc()
  2735.                                    returned a zero result.
  2736.  
  2737.           mSqlErrorGlobalFreeFailed When the lock manager attempted to
  2738.                                    free global memory, GlobalFree()
  2739.                                    returned a non-zero result.
  2740.  
  2741.           mSqlErrorGlobalLockFailed When the query manager attempted to
  2742.                                    lock a global resource, GlobalLock()
  2743.                                    or LockResource() returned an error
  2744.                                    condition.
  2745.  
  2746.           mSqlErrorGlobalUnlockFailed When the query manager attempted
  2747.                                    to unlock a global resource,
  2748.                                    GlobalUnlock() or UnlockResource()
  2749.                                    returned an error condition.
  2750.  
  2751.           mSqlErrorImportParseError This result code will not occur.
  2752.  
  2753.           mSqlErrorIncompatibleTypes An attempt was made within the
  2754.                                    query to perform an operation between
  2755.                                    two arguments whose types conflict.
  2756.                                    An example is adding a text string to
  2757.                                    a number.
  2758.  
  2759.           mSqlErrorIndexExists     An attempt was made within the query
  2760.                                    to create an index whose name is
  2761.                                    already used.
  2762.  
  2763.           mSqlErrorIndexUndoFailed When the b-tree file manager
  2764.                                    attempted to create an unique key
  2765.                                    value a duplicate was found.  The
  2766.                                    attempt to undo the creation failed.
  2767.                                    This is an internal error which
  2768.                                    should never occur.  Please contact
  2769.                                    customer service.
  2770.  
  2771.           mSqlErrorInitializationFailed When the b-tree file manager
  2772.                                    attempted to initialize its tables, a
  2773.                                    failure was detected.  This is an
  2774.                                    internal error which should never
  2775.                                    occur. Please contact customer
  2776.                                    service.
  2777.  
  2778.           mSqlErrorInsufficientBuffer The record to be returned to the
  2779.                                    Quasar SQL API user will not fit in
  2780.                                    the buffer allocated by the user.
  2781.                                    That is, the value of the nRecordSize
  2782.                                    field of the SQLTABLE structure is
  2783.                                    larger than that supplied by the user
  2784.                                    as indicated by the nRecordBufferSize
  2785.                                    field of the SQLCONTROL structure.
  2786.                                    Please be sure to allocate buffers
  2787.  
  2788.  
  2789.  
  2790.  
  2791.                                                                Result Codes
  2792.           Quasar SQL API                                      Page 46 of 52
  2793.  
  2794.  
  2795.                                    large enough to accommodate
  2796.                                    nRecordSize bytes.
  2797.  
  2798.           mSqlErrorInternalError   This is an internal error which
  2799.                                    should never occur.  Please contact
  2800.                                    customer service.
  2801.  
  2802.           mSqlErrorInvalidColumnSpec The arguments of an SQL LIKE
  2803.                                    predicate must be of a character
  2804.                                    string type.
  2805.  
  2806.           mSqlErrorInvalidColumnType This is an internal error which
  2807.                                    should never occur.  Please contact
  2808.                                    customer service.
  2809.  
  2810.           mSqlErrorInvalidCursor   A call was made to the Quasar SQL API
  2811.                                    where the pCursor field of the
  2812.                                    SQLCONTROL structure is set to a
  2813.                                    value which does not match any
  2814.                                    existing cursor.
  2815.  
  2816.           mSqlErrorInvalidData     During the execution of a CREATE
  2817.                                    TABLE query, the scale of a numeric
  2818.                                    column exceeds its precision.
  2819.  
  2820.           mSqlErrorInvalidEscapeChar The data type of the escape
  2821.                                    character in a LIKE predicate is not
  2822.                                    a character string type.
  2823.  
  2824.           mSqlErrorInvalidPattern  The pattern of an SQL LIKE predicate
  2825.                                    must not be NULL.
  2826.  
  2827.           mSqlErrorInvalidUser     The SqlLogin function was called with
  2828.                                    an lpstrUserName or lpstrUserPassword
  2829.                                    argument whose length exceeded
  2830.                                    mSqlMaximumNameLength.
  2831.  
  2832.           mSqlErrorKeyFileCorrupted The b-tree file manager encountered
  2833.                                    illegal settings in the header
  2834.                                    portions of a key file.  It is likely
  2835.                                    that your DOS files are corrupted.
  2836.  
  2837.           mSqlErrorListSizesUnequal The number of columns in the column
  2838.                                    list of an SQL INSERT query does not
  2839.                                    match the number of values in the
  2840.                                    value list or the number of fields
  2841.                                    selected in the subquery.
  2842.  
  2843.           mSqlErrorLockTableFailure The lock table has become corrupted.
  2844.  
  2845.           mSqlErrorMaximumKeySizeExceeded An index definition or unique
  2846.                                    constraint resulted in the
  2847.                                    requirement for a key whose size is
  2848.                                    greater than mSqlMaximumKeySize.
  2849.  
  2850.  
  2851.  
  2852.  
  2853.                                                                Result Codes
  2854.           Quasar SQL API                                      Page 47 of 52
  2855.  
  2856.  
  2857.           mSqlErrorMultipleSelects Only one SELECT statement may occur
  2858.                                    within a query.
  2859.  
  2860.           mSqlErrorNoColumnExists  The bind manager encountered a column
  2861.                                    specification which it could not
  2862.                                    match to a table defined within the
  2863.                                    current scope.
  2864.  
  2865.           mSqlErrorNoIndexExists   A DROP INDEX was attempted when no
  2866.                                    index exists.
  2867.  
  2868.           mSqlErrorNoOldRecord     When the b-tree file manager
  2869.                                    attempted to carry out an
  2870.                                    SqlFetchNext or SqlFetchPrevious
  2871.                                    function, it discovered there was no
  2872.                                    current record.  You must first
  2873.                                    execute an SqlFetchFirst,
  2874.                                    SqlFetchLast or SqlFetchPositioned.
  2875.  
  2876.           mSqlErrorNoTableExists   During execution of a query a table
  2877.                                    name was encountered which cannot be
  2878.                                    found in the database under the
  2879.                                    currently logged-on user name or
  2880.                                    under the explicitly declared user
  2881.                                    name.
  2882.  
  2883.           mSqlErrorNoUserExists    During execution of a query an user
  2884.                                    name was encountered which cannot be
  2885.                                    found in the database.
  2886.  
  2887.           mSqlErrorNodeSizeTooSmall This is an internal error which
  2888.                                    should never occur.  Please contact
  2889.                                    customer service.
  2890.  
  2891.           mSqlErrorNotAggregate    While the select list of a SELECT
  2892.                                    statement started with aggregate
  2893.                                    types (i.e.  SUM()), a select list
  2894.                                    element was later encountered which
  2895.                                    was a simple type (i.e. a column
  2896.                                    specification).  Aggregate types and
  2897.                                    simple types cannot be mixed unless
  2898.                                    the simple type is a grouping column.
  2899.  
  2900.           mSqlErrorNotGroupingColumn A regular column specification was
  2901.                                    encountered where a grouping column
  2902.                                    was required.
  2903.  
  2904.           mSqlErrorNotInGroupedTable While the select list of a SELECT
  2905.                                    statement started with simple types
  2906.                                    (i.e. a column specification), a
  2907.                                    select list element was later
  2908.                                    encountered which was an aggregate
  2909.                                    type (i.e.  SUM()).  Simple types and
  2910.                                    aggregate types cannot be mixed
  2911.  
  2912.  
  2913.  
  2914.  
  2915.                                                                Result Codes
  2916.           Quasar SQL API                                      Page 48 of 52
  2917.  
  2918.  
  2919.                                    unless the simple type is a grouping
  2920.                                    column.
  2921.  
  2922.           mSqlErrorNotSingleRecord A subquery returned more than one
  2923.                                    record.  When a subquery is used as
  2924.                                    an argument to a comparison predicate
  2925.                                    it must return a single record.
  2926.  
  2927.           mSqlErrorNoUserSlotsAvailable No more users can be
  2928.                                    accommodated.
  2929.  
  2930.           mSqlErrorNullInNotNullCol An attempt was made to insert a NULL
  2931.                                    value in a column which was declared
  2932.                                    as NOT NULL.
  2933.  
  2934.           mSqlErrorNullNotAllowed  An attempt was made to use a NULL
  2935.                                    value where NULL values are not
  2936.                                    permitted.
  2937.  
  2938.           mSqlErrorParserSyntaxError There is a syntax error in the SQL
  2939.                                    statement.
  2940.  
  2941.           mSqlErrorParserStackOverflow This is an internal error which
  2942.                                    should never occur.  Please contact
  2943.                                    customer service.
  2944.  
  2945.           mSqlErrorPrecisionConflict A mathematical operation was
  2946.                                    requested which would result in loss
  2947.                                    of precision.
  2948.  
  2949.           mSqlErrorResultTableExists An attempt was made to commit a
  2950.                                    transaction (COMMIT WORK) while a
  2951.                                    result table was still open.  Users
  2952.                                    must close all cursors which have an
  2953.                                    associated result table before
  2954.                                    committing work.
  2955.  
  2956.           mSqlErrorScaleOverflow   The scale of the result of a
  2957.                                    mathematical operation overflowed.
  2958.  
  2959.           mSqlErrorSecurityViolation Either an attempt was made to
  2960.                                    access a table with insufficient
  2961.                                    access privileges or SqlLogin was
  2962.                                    called with an invalid lpstrUserName
  2963.                                    or lpstrUserPassword.
  2964.  
  2965.           mSqlErrorSetFunctionsNested Set functions may not be nested.
  2966.  
  2967.           mSqlErrorStarNotAllowed  The SELECT * syntax is illegal when
  2968.                                    used with the GROUP BY clause.
  2969.  
  2970.           mSqlErrorSubqueryNotOneColumn When a subquery is used as an
  2971.                                    argument to a predicate it must
  2972.  
  2973.  
  2974.  
  2975.  
  2976.  
  2977.                                                                Result Codes
  2978.           Quasar SQL API                                      Page 49 of 52
  2979.  
  2980.  
  2981.                                    return a single field in the select
  2982.                                    list.
  2983.  
  2984.           mSqlErrorSystemAdminRequired The requested function can only
  2985.                                    be performed by the system
  2986.                                    administrator (user "SYSTEM").
  2987.  
  2988.           mSqlErrorTableConflict   The target table of an INSERT, DELETE
  2989.                                    or UPDATE query may not also appear
  2990.                                    in a 'from' clause of a subquery.
  2991.  
  2992.           mSqlErrorTableExists     An attempt was made in a CREATE TABLE
  2993.                                    query to create a table which already
  2994.                                    exists.
  2995.  
  2996.           mSqlErrorTooManyColumnNames The list of column names in an
  2997.                                    INSERT statement exceeds the number
  2998.                                    of columns in the table.
  2999.  
  3000.           mSqlErrorTooManyTablesOpen An attempt was made to open more
  3001.                                    tables than the maximum number of
  3002.                                    tables which may be open at one time.
  3003.  
  3004.           mSqlErrorTrialSizeExceeded The number of events recorded in
  3005.                                    the log has exceeded the trial size
  3006.                                    allotment.  Further operation will
  3007.                                    irrecoverably corrupt your data.
  3008.  
  3009.           mSqlErrorVariableHeaderMark The b-tree file manager
  3010.                                    encountered illegal settings in the
  3011.                                    header portions of a data file.  It
  3012.                                    is likely that your DOS files are
  3013.                                    corrupted.
  3014.  
  3015.           mSqlErrorVariableHeaderSize The b-tree file manager attempted
  3016.                                    to place a record in a position which
  3017.                                    was not large enough.  This is an
  3018.                                    internal error which should never
  3019.                                    occur. Please contact customer
  3020.                                    service.
  3021.  
  3022.           mSqlErrorVariableHeaderWrong The b-tree file manager
  3023.                                    encountered illegal settings in the
  3024.                                    header portions of a data file.  It
  3025.                                    is likely that your DOS files are
  3026.                                    corrupted.
  3027.  
  3028.           mSqlErrorVariableHeaderZero The b-tree file manager
  3029.                                    encountered illegal settings in the
  3030.                                    header portions of a data file.  It
  3031.                                    is likely that your DOS files are
  3032.                                    corrupted.
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.                                                                Result Codes
  3040.           Quasar SQL API                                      Page 50 of 52
  3041.  
  3042.  
  3043.           mSqlErrorWrongVersion    The b-tree file manager has
  3044.                                    determined that your data and key
  3045.                                    files are stamped with a version
  3046.                                    which is incompatible with the
  3047.                                    current release.
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101.                                                                Result Codes
  3102.           Quasar SQL API                                      Page 51 of 52
  3103.  
  3104.  
  3105.                                      Glossary
  3106.  
  3107.  
  3108.           This section defines specialized terms used in this document.
  3109.  
  3110.           B-tree file manager      The Quasar Database Administrator is
  3111.                                    made of several large function units.
  3112.                                    One of these is the b-tree file
  3113.                                    manager.  It is responsible for
  3114.                                    carrying out low level data access
  3115.                                    and operates directly on the raw DOS
  3116.                                    files located in the database
  3117.                                    directory.
  3118.  
  3119.           Bind manager             The Quasar Database Administrator is
  3120.                                    made of several large function units.
  3121.                                    One of these is the bind manager.  It
  3122.                                    is responsible for associating the
  3123.                                    logical constructs in the query with
  3124.                                    actual users, tables and columns in
  3125.                                    the database.
  3126.  
  3127.           Cursor                   The Quasar SQL API keeps track of the
  3128.                                    result of a query by means of a
  3129.                                    cursor.  The  cursor may include
  3130.                                    status information, the table where
  3131.                                    the result of a SELECT may be found,
  3132.                                    the column descriptions for such a
  3133.                                    table, the current record position
  3134.                                    for fetch operations, etc.
  3135.  
  3136.           Database manager         The Quasar Database Administrator is
  3137.                                    made of several large function units.
  3138.                                    One of these is the database manager.
  3139.                                    It is responsible for carrying out
  3140.                                    high level data access and operates
  3141.                                    on logical tables and columns.  The
  3142.                                    database manager uses the b-tree file
  3143.                                    manager to access records in the raw
  3144.                                    DOS files located in the database
  3145.                                    directory.  The database manager is
  3146.                                    also responsible for policing
  3147.                                    transactions and the transaction
  3148.                                    journal (or 'log').
  3149.  
  3150.           Dump manager             The Quasar Database Administrator is
  3151.                                    made of several large function units.
  3152.                                    One of these is the dump manager.  It
  3153.                                    is responsible for creating the dump
  3154.                                    file.
  3155.  
  3156.           Lock manager             The Quasar Database Administrator is
  3157.                                    made of several large function units.
  3158.                                    One of these is the lock manager.  It
  3159.  
  3160.  
  3161.  
  3162.  
  3163.                                                                    Glossary
  3164.           Quasar SQL API                                      Page 52 of 52
  3165.  
  3166.  
  3167.                                    is responsible for concurrency
  3168.                                    control.
  3169.  
  3170.           Physical position        The raw position of the record in the
  3171.                                    file.  Physical order is not the same
  3172.                                    as the order you specify with the SQL
  3173.                                    ORDER BY clause.
  3174.  
  3175.           Query                    By query we mean any SQL statement.
  3176.  
  3177.           Query manager            The Quasar Database Administrator is
  3178.                                    made of several large function units.
  3179.                                    One of these is the query manager.
  3180.                                    It is responsible for parsing the
  3181.                                    query into its component parts.
  3182.  
  3183.           Record buffer            One of the arguments to the Quasar
  3184.                                    SQL API fetch functions is a pointer
  3185.                                    to a record buffer.  This is the
  3186.                                    buffer which receives the formatted
  3187.                                    contents of a record.
  3188.  
  3189.           Result table             All SELECT queries generate a table
  3190.                                    containing the chosen records.  This
  3191.                                    is called the result table.  Its
  3192.                                    contents are made available to you
  3193.                                    one at a time through one of the
  3194.                                    Quasar SQL API fetch functions.
  3195.  
  3196.           Transaction journal      A transaction journal is a pair of
  3197.                                    files ('or_log.dat' and 'or_log.idx')
  3198.                                    written by the database manager.  The
  3199.                                    transaction journal contains a record
  3200.                                    for every event which caused a change
  3201.                                    to the database.
  3202.  
  3203.  
  3204.  
  3205.  
  3206.  
  3207.  
  3208.  
  3209.  
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.                                                                    Glossary